Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[llvm] [refactor] Link modules instead of cloning modules #5962

Merged
merged 9 commits into from
Sep 6, 2022

Conversation

lin-hitonami
Copy link
Contributor

@lin-hitonami lin-hitonami commented Sep 2, 2022

Related issue = #5511

The PR seems a bit messy but I can't split it to smaller PRs because these changes must be done together to make the program run.

This PR roughly does things as follows:

  1. Adds link_context_data and function link_compile_data in TaichiLLVMContext for linking.
  2. Replace struct_module with struct_modules in ThreadLocalData. The struct_modules is a map that stores struct modules of every SNodeTree (The ID of the SNodeTree is the key of the map).
  3. Let get_runtime_function and get_struct_function return a function declaration rather than the function definition.
  4. Create a new module when starting to construct a struct module or a kernel module instead of cloning the struct module.
  5. Support AOT and WASM.
  6. Fix tests.

compile_kernel_to_module returns a vector with only one element now. The kernel cache contains only one module now, so it doesn't need to be stored in a vector anymore. I will refactor them later.

@netlify
Copy link

netlify bot commented Sep 2, 2022

Deploy Preview for docsite-preview ready!

Name Link
🔨 Latest commit 7af9ff8
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/6311d62fd91dec000a9be7ca
😎 Deploy Preview https://deploy-preview-5962--docsite-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@lin-hitonami lin-hitonami added the full-ci Run complete set of CI tests label Sep 2, 2022
Copy link
Contributor

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!!!
Only had a fews nits inline.
Btw good to test if building with TI_WITH_LLVM=OFF still works after this PR locally before merging :P

taichi/runtime/llvm/llvm_context.h Outdated Show resolved Hide resolved
taichi/runtime/llvm/llvm_context.h Outdated Show resolved Hide resolved
taichi/codegen/codegen.cpp Show resolved Hide resolved
taichi/codegen/wasm/codegen_wasm.h Show resolved Hide resolved
@lin-hitonami lin-hitonami merged commit 5f61a03 into taichi-dev:master Sep 6, 2022
@lin-hitonami lin-hitonami deleted the link branch September 6, 2022 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full-ci Run complete set of CI tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants